#pragma once
#include "widgets.h"
#include <QObject>
#include <QPoint>

class QWidget;

enum DragArea
{
	kNone,
	kLeft,
	kTop,
	kRight,
	kBottom,
	kTopLeft,
	kTopRight,
	kBottomRight,
	kBottomLeft
};

class S_WIDGETS_EXPORT WidgetResizer : public QObject
{
public:
	WidgetResizer(QWidget* w);

	void enable(bool v);

protected:
	bool eventFilter(QObject *watched, QEvent *event) override;

private:
	void resetDragState();

private:
	QWidget* m_hostWidget = nullptr;
	bool		m_dragging = false;
	DragArea	m_dragArea = kNone;
	QPoint	m_dragPos;
};
